package com.bzsg.rightsManagementSystem.config.security_config

import com.bzsg.rightsManagementSystem.util.result.ResultUtil
import com.bzsg.rightsManagementSystem.write
import org.springframework.security.core.Authentication
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler
import org.springframework.stereotype.Component
import java.io.IOException
import javax.servlet.ServletException
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@Component
class CustomizeLogoutSuccessHandler : LogoutSuccessHandler {
    @Throws(IOException::class, ServletException::class)
    override fun onLogoutSuccess(
        httpServletRequest: HttpServletRequest,
        httpServletResponse: HttpServletResponse,
        authentication: Authentication
    ) {
        httpServletResponse.contentType = "text/json;charset=utf-8"
        httpServletResponse.write(ResultUtil.success())
    }
}